<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
        }
        .one {
            width: 100px;
            height: 100px;
            margin-left: 10%;
            background-color: orangered;
        }
        .parent {
            width: 200px;
            box-sizing: border-box;
            padding: 20px;
        }
    </style>
</head>
<body>
    <!-- 
        边距设置百分比是基于父元素的width（内容宽度）来设置的(不是总宽度)
        上面盒子设置padding之后，margin-left变为16px
     -->
    <div class="parent">
        <div class="one"></div>
    </div>
</body>
</html>